<template>
    <h2 class="bg-green-700 text-white text-center">
        {{ article.title }}
    </h2>

    <div class="content mt-3 border">
        {{ article.content }}
    </div>

    <div class="mt-3 bg-red-700 text-white py-3 cursor-pointer text-center" @click="$router.push({ name: 'home' })">
        返回首页
    </div>
</template>

<script setup>
import { useRoute } from 'vue-router'
import { ref } from 'vue'
// import RequestPromise from '@/use/RequestPromise'
import axios from '@/plugins/axios'

const route = useRoute()
const article = ref({})
// const { find } = RequestPromise()
// find(route.query.id).then(_ => {
//     article.value = _
// })
axios.get(`news/${route.query.id}`).then(_ => (article.value = _))
</script>

<style></style>
